#ifndef ISCSI_DISCOVERY_SERV_H
#define ISCSI_DISCOVERY_SERV_H

#ifdef __GNUC__
#define GNUC_PACKED    __attribute__ ((packed))
#else
#define GNUC_PACKED
#endif

#ifdef __arm
#define ARM_PACKED    __packed
#else
#define ARM_PACKED
#endif

#if defined WIN32 || defined WIN64
#pragma pack(1)
#endif

#define MAX_RACK_UNIT_NUM 4
#define MAX_DISK_UNIT_NUM 12
#define SERVICE_PORT 12345

#define IP_LENGTH			16
#define TARGET_LENGTH		233
#define DEVICE_LENGTH		256


/* request type*/
#define ADD_TARGET_PORTAL		0x01
#define REMOVE_TARGET_PORTAL	0x02
#define LOGOUT_ALL				0x03

/* request data */
typedef struct ARM_PACKED ISCSI_SERVICE_QEQUEST
{
	int sizeOfData;
	int type;
	char ipaddr[IP_LENGTH];
}GNUC_PACKED ISCSI_SERVICE_QEQUEST;


/* response type */
#define HOST_STATUS		0x01
#define DEVICE_STATUS	0x02

/* response data */
typedef struct ARM_PACKED ISCSI_SERVICE_RESPONCE
{
	int sizeOfData;
	int type;
	char data[0];
}GNUC_PACKED ISCSI_SERVICE_RESPONCE;


/* rack status */
#define HOST_STATUS_DISCONNECTED	0x00
#define HOST_STATUS_CONNECTED		0x01

typedef struct  ARM_PACKED ISCSI_RACK_STATUS
{
	int status;
	char ipaddr[IP_LENGTH];
}GNUC_PACKED ISCSI_RACK_STATUS;

/* device status */
#define DEVICE_ADD		0x01
#define DEVICE_REMOVE	0x02

typedef struct ARM_PACKED ISCSI_DEVICE_STATUS
{
	int status;
	char ipaddr[IP_LENGTH];
	char target[TARGET_LENGTH];
	char device[DEVICE_LENGTH];
}GNUC_PACKED ISCSI_DEVICE_STATUS;

#endif